<!DOCTYPE html>
<html lang="zh-CN"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	layout:decorator="layout/default">
<head>
<meta charset="UTF-8">
<title>角色管理</title>
    <script th:src="@{/assets/scripts/search.js}"></script>
<script>
	$(document).ready(function (){
		Search.searchKeyUp();
	});
	function page(n, s) {
		if(n==null || n == ""){
			$(".real-key").val($(".show-key").val());
		}
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#roleSearchForm").submit();
		return false;
	}
</script>
</head>
<body shiro:has-permission="sys:role:view">
	<div layout:fragment="content" th:remove="tag">
		<div
			th:replace="fragments/tool :: tipMessage (type='',content=${message})"
			th:remove="tag"></div>
		<div class="row">
			<div class="col-md-12">
				<!-- BEGIN PAGE TITLE & BREADCRUMB-->
				<ul class="page-breadcrumb breadcrumb">
					<li><i class="fa fa-home"></i> <a th:href="@{/}">首页</a> <i
						class="fa fa-angle-right"></i></li>
					<li><a href="#">权限管理</a> <i class="fa fa-angle-right"></i></li>
					<li><a th:href="@{/sys/role}">角色管理</a></li>
				</ul>
				<!-- END PAGE TITLE & BREADCRUMB-->

			</div>
		</div>


		<div class="row profile">
			<div class="col-md-12">
				<!--BEGIN TABS-->
				<div class="tabbable tabbable-custom tabbable-full-width">

					<div class="tab-content">
						<div id="role_tab_1_1">
							<div class="row search-form-default alert alert-info">
								<div class="col-md-7">
									<form id="roleSearchForm" th:object="${role}"
										th:action="@{/sys/role/}" method="post" class="form-inline">
										<input id="pageNo" name="pageNo" type="hidden"
											th:value="${page.pageNo}" /> <input id="pageSize"
											name="pageSize" type="hidden" th:value="${page.pageSize}" />
										<input id="orderBy" name="orderBy" type="hidden"
											th:value="${page.orderBy}" />

										<div class="input-group input-xlarge">

											<!-- /btn-group -->
											<input type="text" th:value="${role.name}" class="form-control show-key" maxlength="100" />
											
											<input type="hidden" class="form-control real-key" 
												th:field="*{name}" maxlength="100" />	
											<div class="input-group-btn">
												<button type="button" class="btn green search-button"
													onclick="return page();">
													搜索 &nbsp;<i class="m-icon-swapright m-icon-white"></i>
												</button>
											</div>
											<!-- /btn-group -->

										</div>
									</form>
								</div>
								<div class="col-md-5" style="text-align: right;">
									<a th:href="@{/sys/role/form}" class="btn blue" shiro:has-permission="sys:role:add"><span> + 角色添加</span></a>
								</div>

							</div>
							<div class="row">
								<div class="col-md-12">
									<table id="contentTable"
										class="table table-striped table-bordered table-advance table-hover">
										<thead>
											<tr>
												<th>角色名称</th>
												<th>所属机构</th>
												<th width="150px">创建时间</th>
												<th>数据范围</th>
												<th>角色描述</th>
												<th width="100px">创建者</th>
												<th shiro:has-any-permissions="sys:role:edit,sys:role:delete">操作</th>
											</tr>
										</thead>
										<tbody>
											<tr th:each="item : ${page.list}">
												<td><p class="ellipsis">
														<th:block th:text="${item.name}"></th:block>
													</p></td>
												<td><p class="ellipsis">
														<th:block th:text="${item.office.name}" />
													</p></td>
												<td><p>
														<th:block
															th:text="${#dates.format(item.createDate, 'yyyy-MM-dd HH:mm:ss')}" />
													<p></td>
												<td><p class="ellipsis">
														<th:block
															th:text="${@userMenus.getDictLabel(item.dataScope, 'sys_data_scope', '无')}" />
													</p></td>
												<td><p class="ellipsis">
														<th:block th:text="${item.remarks}" />
													</p></td>
												<td><p class="ellipsis">
														<th:block th:text="${item.createBy.loginName}" />
													</p></td>
												<td shiro:has-any-permissions="sys:role:edit,sys:role:delete"><a th:href="@{/sys/role/form(id=${item.id})}"
													class="btn default btn-xs blue-stripe" shiro:has-permission="sys:role:edit">修改</a> <a
													th:href="@{/sys/role/delete(id=${item.id})}"
													onclick="return App.confirm('确认要删除该角色吗？', this.href)" shiro:has-permission="sys:role:delete"
													class="btn default btn-xs red-stripe">删除</a></td>
											</tr>
										</tbody>
									</table>
								</div>
								<div class="row margin-top-20">
									<div class="col-md-12">
										<th:block th:utext="${page}" />
									</div>
								</div>

							</div>
						</div>

					</div>
				</div>
			</div>
		</div>


	</div>


</body>
</html>
